
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Gulp · TypeScript Handbook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Patrick Zhong">
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Knockout.html" />
    
    
    <link rel="prev" href="ASP.NET 4.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="./">
            
                <a href="./">
            
                    
                    快速上手
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="TypeScript in 5 minutes.html">
            
                <a href="TypeScript in 5 minutes.html">
            
                    
                    5分钟了解TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="ASP.NET Core.html">
            
                <a href="ASP.NET Core.html">
            
                    
                    ASP.NET Core
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="ASP.NET 4.html">
            
                <a href="ASP.NET 4.html">
            
                    
                    ASP.NET 4
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.4" data-path="Gulp.html">
            
                <a href="Gulp.html">
            
                    
                    Gulp
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="Knockout.html">
            
                <a href="Knockout.html">
            
                    
                    Knockout.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="React & Webpack.html">
            
                <a href="React & Webpack.html">
            
                    
                    React与webpack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="React.html">
            
                <a href="React.html">
            
                    
                    React
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="Angular 2.html">
            
                <a href="Angular 2.html">
            
                    
                    Angular 2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="Migrating from JavaScript.html">
            
                <a href="Migrating from JavaScript.html">
            
                    
                    从JavaScript迁移到TypeScript
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../">
            
                <a href="../">
            
                    
                    手册
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Basic Types.html">
            
                <a href="../Basic Types.html">
            
                    
                    基础类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Variable Declarations.html">
            
                <a href="../Variable Declarations.html">
            
                    
                    变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Interfaces.html">
            
                <a href="../Interfaces.html">
            
                    
                    接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Classes.html">
            
                <a href="../Classes.html">
            
                    
                    类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../Functions.html">
            
                <a href="../Functions.html">
            
                    
                    函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../Generics.html">
            
                <a href="../Generics.html">
            
                    
                    泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../Enums.html">
            
                <a href="../Enums.html">
            
                    
                    枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../Type Inference.html">
            
                <a href="../Type Inference.html">
            
                    
                    类型推论
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../Type Compatibility.html">
            
                <a href="../Type Compatibility.html">
            
                    
                    类型兼容性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../Advanced Types.html">
            
                <a href="../Advanced Types.html">
            
                    
                    高级类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.11" data-path="../Utilit Types.md">
            
                <span>
            
                    
                    实用工具类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.12" data-path="../Symbols.html">
            
                <a href="../Symbols.html">
            
                    
                    Symbols
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.13" data-path="../Iterators and Generators.html">
            
                <a href="../Iterators and Generators.html">
            
                    
                    Iterators 和 Generators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.14" data-path="../Modules.html">
            
                <a href="../Modules.html">
            
                    
                    模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.15" data-path="../Namespaces.html">
            
                <a href="../Namespaces.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.16" data-path="../Namespaces and Modules.html">
            
                <a href="../Namespaces and Modules.html">
            
                    
                    命名空间和模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.17" data-path="../Module Resolution.html">
            
                <a href="../Module Resolution.html">
            
                    
                    模块解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.18" data-path="../Declaration Merging.html">
            
                <a href="../Declaration Merging.html">
            
                    
                    声明合并
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.19" data-path="../Writing Definition Files.html">
            
                <a href="../Writing Definition Files.html">
            
                    
                    书写.d.ts文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.20" data-path="../JSX.html">
            
                <a href="../JSX.html">
            
                    
                    JSX
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.21" data-path="../Decorators.html">
            
                <a href="../Decorators.html">
            
                    
                    Decorators
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.22" data-path="../Mixins.html">
            
                <a href="../Mixins.html">
            
                    
                    混入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.23" data-path="../Triple-Slash Directives.html">
            
                <a href="../Triple-Slash Directives.html">
            
                    
                    三斜线指令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.24" data-path="../Type Checking JavaScript Files.html">
            
                <a href="../Type Checking JavaScript Files.html">
            
                    
                    JavaScript文件里的类型检查
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../declaration files/Introduction.html">
            
                <a href="../declaration files/Introduction.html">
            
                    
                    如何书写声明文件
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../declaration files/Library Structures.html">
            
                <a href="../declaration files/Library Structures.html">
            
                    
                    结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../declaration files/Do's and Don'ts.html">
            
                <a href="../declaration files/Do's and Don'ts.html">
            
                    
                    规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../declaration files/By Example.html">
            
                <a href="../declaration files/By Example.html">
            
                    
                    举例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../declaration files/Deep Dive.html">
            
                <a href="../declaration files/Deep Dive.html">
            
                    
                    深入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../declaration files/Publishing.html">
            
                <a href="../declaration files/Publishing.html">
            
                    
                    发布
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../declaration files/Consumption.html">
            
                <a href="../declaration files/Consumption.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../tsconfig.json.html">
            
                <a href="../tsconfig.json.html">
            
                    
                    工程配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../tsconfig.json.html">
            
                <a href="../tsconfig.json.html">
            
                    
                    tsconfig.json
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Project References.html">
            
                <a href="../Project References.html">
            
                    
                    工程引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Typings for NPM Packages.html">
            
                <a href="../Typings for NPM Packages.html">
            
                    
                    NPM包的类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Compiler Options.html">
            
                <a href="../Compiler Options.html">
            
                    
                    编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Configuring Watch.html">
            
                <a href="../Configuring Watch.html">
            
                    
                    配置 Watch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../Compiler Options in MSBuild.html">
            
                <a href="../Compiler Options in MSBuild.html">
            
                    
                    在MSBuild里使用编译选项
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../Integrating with Build Tools.html">
            
                <a href="../Integrating with Build Tools.html">
            
                    
                    与其它构建工具整合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../Nightly Builds.html">
            
                <a href="../Nightly Builds.html">
            
                    
                    使用TypeScript的每日构建版本
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../wiki/">
            
                <a href="../../wiki/">
            
                    
                    Wiki
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../wiki/this-in-TypeScript.html">
            
                <a href="../../wiki/this-in-TypeScript.html">
            
                    
                    TypeScript里的this
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../wiki/coding_guidelines.html">
            
                <a href="../../wiki/coding_guidelines.html">
            
                    
                    编码规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../wiki/Common Errors.html">
            
                <a href="../../wiki/Common Errors.html">
            
                    
                    常见编译错误
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../../wiki/TypeScript-Editor-Support.html">
            
                <a href="../../wiki/TypeScript-Editor-Support.html">
            
                    
                    支持TypeScript的编辑器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                <a href="../../wiki/Using-TypeScript-With-ASP.NET-5.html">
            
                    
                    结合ASP.NET v5使用TypeScript
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../../wiki/Architectural-Overview.html">
            
                <a href="../../wiki/Architectural-Overview.html">
            
                    
                    架构概述
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../../wiki/Roadmap.html">
            
                <a href="../../wiki/Roadmap.html">
            
                    
                    发展路线图
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../../release-notes/">
            
                <a href="../../release-notes/">
            
                    
                    新增功能
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../../release-notes/TypeScript 3.1.html">
            
                <a href="../../release-notes/TypeScript 3.1.html">
            
                    
                    TypeScript 3.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../../release-notes/TypeScript 3.0.html">
            
                <a href="../../release-notes/TypeScript 3.0.html">
            
                    
                    TypeScript 3.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../../release-notes/TypeScript 2.9.html">
            
                <a href="../../release-notes/TypeScript 2.9.html">
            
                    
                    TypeScript 2.9
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../../release-notes/TypeScript 2.8.html">
            
                <a href="../../release-notes/TypeScript 2.8.html">
            
                    
                    TypeScript 2.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../../release-notes/TypeScript 2.7.html">
            
                <a href="../../release-notes/TypeScript 2.7.html">
            
                    
                    TypeScript 2.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../../release-notes/TypeScript 2.6.html">
            
                <a href="../../release-notes/TypeScript 2.6.html">
            
                    
                    TypeScript 2.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../../release-notes/TypeScript 2.5.html">
            
                <a href="../../release-notes/TypeScript 2.5.html">
            
                    
                    TypeScript 2.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../../release-notes/TypeScript 2.4.html">
            
                <a href="../../release-notes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../../release-notes/TypeScript 2.3.html">
            
                <a href="../../release-notes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../../release-notes/TypeScript 2.2.html">
            
                <a href="../../release-notes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.11" data-path="../../release-notes/TypeScript 2.1.html">
            
                <a href="../../release-notes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.12" data-path="../../release-notes/TypeScript 2.0.html">
            
                <a href="../../release-notes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.13" data-path="../../release-notes/TypeScript 1.8.html">
            
                <a href="../../release-notes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.14" data-path="../../release-notes/TypeScript 1.7.html">
            
                <a href="../../release-notes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.15" data-path="../../release-notes/TypeScript 1.6.html">
            
                <a href="../../release-notes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.16" data-path="../../release-notes/TypeScript 1.5.html">
            
                <a href="../../release-notes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.17" data-path="../../release-notes/TypeScript 1.4.html">
            
                <a href="../../release-notes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.18" data-path="../../release-notes/TypeScript 1.3.html">
            
                <a href="../../release-notes/TypeScript 1.3.html">
            
                    
                    TypeScript 1.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.19" data-path="../../release-notes/TypeScript 1.1.html">
            
                <a href="../../release-notes/TypeScript 1.1.html">
            
                    
                    TypeScript 1.1
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../../breaking-changes/breaking-changes.html">
            
                <a href="../../breaking-changes/breaking-changes.html">
            
                    
                    Breaking Changes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../../breaking-changes/TypeScript 2.4.html">
            
                <a href="../../breaking-changes/TypeScript 2.4.html">
            
                    
                    TypeScript 2.4
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../../breaking-changes/TypeScript 2.3.html">
            
                <a href="../../breaking-changes/TypeScript 2.3.html">
            
                    
                    TypeScript 2.3
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../../breaking-changes/TypeScript 2.2.html">
            
                <a href="../../breaking-changes/TypeScript 2.2.html">
            
                    
                    TypeScript 2.2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../../breaking-changes/TypeScript 2.1.html">
            
                <a href="../../breaking-changes/TypeScript 2.1.html">
            
                    
                    TypeScript 2.1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../../breaking-changes/TypeScript 2.0.html">
            
                <a href="../../breaking-changes/TypeScript 2.0.html">
            
                    
                    TypeScript 2.0
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../../breaking-changes/TypeScript 1.8.html">
            
                <a href="../../breaking-changes/TypeScript 1.8.html">
            
                    
                    TypeScript 1.8
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.7" data-path="../../breaking-changes/TypeScript 1.7.html">
            
                <a href="../../breaking-changes/TypeScript 1.7.html">
            
                    
                    TypeScript 1.7
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.8" data-path="../../breaking-changes/TypeScript 1.6.html">
            
                <a href="../../breaking-changes/TypeScript 1.6.html">
            
                    
                    TypeScript 1.6
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.9" data-path="../../breaking-changes/TypeScript 1.5.html">
            
                <a href="../../breaking-changes/TypeScript 1.5.html">
            
                    
                    TypeScript 1.5
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.10" data-path="../../breaking-changes/TypeScript 1.4.html">
            
                <a href="../../breaking-changes/TypeScript 1.4.html">
            
                    
                    TypeScript 1.4
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >Gulp</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <p>&#x8FD9;&#x7BC7;&#x5FEB;&#x901F;&#x4E0A;&#x624B;&#x6307;&#x5357;&#x5C06;&#x6559;&#x4F60;&#x5982;&#x4F55;&#x4F7F;&#x7528;<a href="http://gulpjs.com" target="_blank">Gulp</a>&#x6784;&#x5EFA;TypeScript&#xFF0C;&#x548C;&#x5982;&#x4F55;&#x5728;Gulp&#x7BA1;&#x9053;&#x91CC;&#x6DFB;&#x52A0;<a href="http://browserify.org" target="_blank">Browserify</a>&#xFF0C;<a href="http://lisperator.net/uglifyjs/" target="_blank">uglify</a>&#x6216;<a href="https://github.com/substack/watchify" target="_blank">Watchify</a>&#x3002;
&#x5B83;&#x8FD8;&#x5305;&#x6DB5;&#x4E86;<a href="https://babeljs.io/" target="_blank">Babel</a>&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x901A;&#x8FC7;&#x4F7F;&#x7528;<a href="https://github.com/babel/babelify" target="_blank">Babelify</a>&#x3002;</p>
<p>&#x8FD9;&#x91CC;&#x5047;&#x8BBE;&#x4F60;&#x5DF2;&#x7ECF;&#x5728;&#x4F7F;&#x7528;<a href="https://nodejs.org/" target="_blank">Node.js</a>&#x548C;<a href="https://www.npmjs.com/" target="_blank">npm</a>&#x4E86;&#x3002;</p>
<h1 id="&#x521B;&#x5EFA;&#x7B80;&#x5355;&#x5DE5;&#x7A0B;">&#x521B;&#x5EFA;&#x7B80;&#x5355;&#x5DE5;&#x7A0B;</h1>
<p>&#x6211;&#x4EEC;&#x9996;&#x5148;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x65B0;&#x76EE;&#x5F55;&#x3002;
&#x547D;&#x540D;&#x4E3A;<code>proj</code>&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4EFB;&#x4F55;&#x4F60;&#x559C;&#x6B22;&#x7684;&#x540D;&#x5B57;&#x3002;</p>
<pre><code class="lang-shell">mkdir proj
cd proj
</code></pre>
<p>&#x6211;&#x4EEC;&#x5C06;&#x4EE5;&#x4E0B;&#x9762;&#x7684;&#x7ED3;&#x6784;&#x5F00;&#x59CB;&#x6211;&#x4EEC;&#x7684;&#x5DE5;&#x7A0B;&#xFF1A;</p>
<pre><code class="lang-text">proj/
   &#x251C;&#x2500; src/
   &#x2514;&#x2500; dist/
</code></pre>
<p>TypeScript&#x6587;&#x4EF6;&#x653E;&#x5728;<code>src</code>&#x6587;&#x4EF6;&#x5939;&#x4E0B;&#xFF0C;&#x7ECF;&#x8FC7;TypeScript&#x7F16;&#x8BD1;&#x5668;&#x7F16;&#x8BD1;&#x751F;&#x6210;&#x7684;&#x76EE;&#x6807;&#x6587;&#x4EF6;&#x653E;&#x5728;<code>dist</code>&#x76EE;&#x5F55;&#x4E0B;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x8BA9;&#x6211;&#x4EEC;&#x6765;&#x521B;&#x5EFA;&#x8FD9;&#x4E9B;&#x6587;&#x4EF6;&#x5939;&#xFF1A;</p>
<pre><code class="lang-shell">mkdir src
mkdir dist
</code></pre>
<h2 id="&#x521D;&#x59CB;&#x5316;&#x5DE5;&#x7A0B;">&#x521D;&#x59CB;&#x5316;&#x5DE5;&#x7A0B;</h2>
<p>&#x73B0;&#x5728;&#x8BA9;&#x6211;&#x4EEC;&#x628A;&#x8FD9;&#x4E2A;&#x6587;&#x4EF6;&#x5939;&#x8F6C;&#x6362;&#x6210;npm&#x5305;&#xFF1A;</p>
<pre><code class="lang-shell">npm init
</code></pre>
<p>&#x4F60;&#x5C06;&#x770B;&#x5230;&#x6709;&#x4E00;&#x4E9B;&#x63D0;&#x793A;&#x64CD;&#x4F5C;&#x3002;
&#x9664;&#x4E86;&#x5165;&#x53E3;&#x6587;&#x4EF6;&#x5916;&#xFF0C;&#x5176;&#x4F59;&#x7684;&#x90FD;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x9879;&#x3002;
&#x5165;&#x53E3;&#x6587;&#x4EF6;&#x4F7F;&#x7528;<code>./dist/main.js</code>&#x3002;
&#x4F60;&#x53EF;&#x4EE5;&#x968F;&#x65F6;&#x5728;<code>package.json</code>&#x6587;&#x4EF6;&#x91CC;&#x66F4;&#x6539;&#x751F;&#x6210;&#x7684;&#x914D;&#x7F6E;&#x3002;</p>
<h2 id="&#x5B89;&#x88C5;&#x4F9D;&#x8D56;&#x9879;">&#x5B89;&#x88C5;&#x4F9D;&#x8D56;&#x9879;</h2>
<p>&#x73B0;&#x5728;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;<code>npm install</code>&#x547D;&#x4EE4;&#x6765;&#x5B89;&#x88C5;&#x5305;&#x3002;
&#x9996;&#x5148;&#x5168;&#x5C40;&#x5B89;&#x88C5;<code>gulp-cli</code>&#xFF08;&#x5982;&#x679C;&#x4F60;&#x4F7F;&#x7528;Unix&#x7CFB;&#x7EDF;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x5728;<code>npm install</code>&#x547D;&#x4EE4;&#x4E0A;&#x4F7F;&#x7528;<code>sudo</code>&#xFF09;&#x3002;</p>
<pre><code class="lang-shell">npm install -g gulp-cli
</code></pre>
<p>&#x7136;&#x540E;&#x5B89;&#x88C5;<code>typescript</code>&#xFF0C;<code>gulp</code>&#x548C;<code>gulp-typescript</code>&#x5230;&#x5F00;&#x53D1;&#x4F9D;&#x8D56;&#x9879;&#x3002;
<a href="https://www.npmjs.com/package/gulp-typescript" target="_blank">Gulp-typescript</a>&#x662F;TypeScript&#x7684;&#x4E00;&#x4E2A;Gulp&#x63D2;&#x4EF6;&#x3002;</p>
<pre><code class="lang-shell">npm install --save-dev typescript gulp gulp-typescript
</code></pre>
<h2 id="&#x5199;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;">&#x5199;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;</h2>
<p>&#x8BA9;&#x6211;&#x4EEC;&#x5199;&#x4E00;&#x4E2A;Hello World&#x7A0B;&#x5E8F;&#x3002;
&#x5728;<code>src</code>&#x76EE;&#x5F55;&#x4E0B;&#x521B;&#x5EFA;<code>main.ts</code>&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">hello</span>(<span class="hljs-params">compiler: <span class="hljs-built_in">string</span></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Hello from <span class="hljs-subst">${compiler}</span>`</span>);
}
hello(<span class="hljs-string">&quot;TypeScript&quot;</span>);
</code></pre>
<p>&#x5728;&#x5DE5;&#x7A0B;&#x7684;&#x6839;&#x76EE;&#x5F55;<code>proj</code>&#x4E0B;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;<code>tsconfig.json</code>&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;files&quot;</span>: [
        <span class="hljs-string">&quot;src/main.ts&quot;</span>
    ],
    <span class="hljs-string">&quot;compilerOptions&quot;</span>: {
        <span class="hljs-string">&quot;noImplicitAny&quot;</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-string">&quot;target&quot;</span>: <span class="hljs-string">&quot;es5&quot;</span>
    }
}
</code></pre>
<h2 id="&#x65B0;&#x5EFA;gulpfilejs&#x6587;&#x4EF6;">&#x65B0;&#x5EFA;<code>gulpfile.js</code>&#x6587;&#x4EF6;</h2>
<p>&#x5728;&#x5DE5;&#x7A0B;&#x6839;&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;<code>gulpfile.js</code>&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> gulp = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp&quot;</span>);
<span class="hljs-keyword">var</span> ts = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp-typescript&quot;</span>);
<span class="hljs-keyword">var</span> tsProject = ts.createProject(<span class="hljs-string">&quot;tsconfig.json&quot;</span>);

gulp.task(<span class="hljs-string">&quot;default&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> tsProject.src()
        .pipe(tsProject())
        .js.pipe(gulp.dest(<span class="hljs-string">&quot;dist&quot;</span>));
});
</code></pre>
<h2 id="&#x6D4B;&#x8BD5;&#x8FD9;&#x4E2A;&#x5E94;&#x7528;">&#x6D4B;&#x8BD5;&#x8FD9;&#x4E2A;&#x5E94;&#x7528;</h2>
<pre><code class="lang-shell">gulp
node dist/main.js
</code></pre>
<p>&#x7A0B;&#x5E8F;&#x5E94;&#x8BE5;&#x80FD;&#x591F;&#x6253;&#x5370;&#x51FA;&#x201C;Hello from TypeScript!&#x201D;&#x3002;</p>
<h1 id="&#x5411;&#x4EE3;&#x7801;&#x91CC;&#x6DFB;&#x52A0;&#x6A21;&#x5757;">&#x5411;&#x4EE3;&#x7801;&#x91CC;&#x6DFB;&#x52A0;&#x6A21;&#x5757;</h1>
<p>&#x5728;&#x4F7F;&#x7528;Browserify&#x524D;&#xFF0C;&#x8BA9;&#x6211;&#x4EEC;&#x5148;&#x6784;&#x5EFA;&#x4E00;&#x4E0B;&#x4EE3;&#x7801;&#x7136;&#x540E;&#x518D;&#x6DFB;&#x52A0;&#x4E00;&#x4E9B;&#x6DF7;&#x5165;&#x7684;&#x6A21;&#x5757;&#x3002;
&#x8FD9;&#x4E2A;&#x7ED3;&#x6784;&#x5C06;&#x662F;&#x4F60;&#x5728;&#x771F;&#x5B9E;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E2D;&#x4F1A;&#x7528;&#x5230;&#x7684;&#x3002;</p>
<p>&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;<code>src/greet.ts</code>&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">export</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sayHello</span>(<span class="hljs-params">name: <span class="hljs-built_in">string</span></span>) </span>{
    <span class="hljs-keyword">return</span> <span class="hljs-string">`Hello from <span class="hljs-subst">${name}</span>`</span>;
}
</code></pre>
<p>&#x66F4;&#x6539;<code>src/main.ts</code>&#x4EE3;&#x7801;&#xFF0C;&#x4ECE;<code>greet.ts</code>&#x5BFC;&#x5165;<code>sayHello</code>&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> { sayHello } from <span class="hljs-string">&quot;./greet&quot;</span>;

<span class="hljs-built_in">console</span>.log(sayHello(<span class="hljs-string">&quot;TypeScript&quot;</span>));
</code></pre>
<p>&#x6700;&#x540E;&#xFF0C;&#x5C06;<code>src/greet.ts</code>&#x6DFB;&#x52A0;&#x5230;<code>tsconfig.json</code>&#xFF1A;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;files&quot;</span>: [
        <span class="hljs-string">&quot;src/main.ts&quot;</span>,
        <span class="hljs-string">&quot;src/greet.ts&quot;</span>
    ],
    <span class="hljs-string">&quot;compilerOptions&quot;</span>: {
        <span class="hljs-string">&quot;noImplicitAny&quot;</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-string">&quot;target&quot;</span>: <span class="hljs-string">&quot;es5&quot;</span>
    }
}
</code></pre>
<p>&#x786E;&#x4FDD;&#x6267;&#x884C;<code>gulp</code>&#x540E;&#x6A21;&#x5757;&#x662F;&#x80FD;&#x5DE5;&#x4F5C;&#x7684;&#xFF0C;&#x5728;Node.js&#x4E0B;&#x8FDB;&#x884C;&#x6D4B;&#x8BD5;&#xFF1A;</p>
<pre><code class="lang-shell">gulp
node dist/main.js
</code></pre>
<p>&#x6CE8;&#x610F;&#xFF0C;&#x5373;&#x4F7F;&#x6211;&#x4EEC;&#x4F7F;&#x7528;&#x4E86;ES2015&#x7684;&#x6A21;&#x5757;&#x8BED;&#x6CD5;&#xFF0C;TypeScript&#x8FD8;&#x662F;&#x4F1A;&#x751F;&#x6210;Node.js&#x4F7F;&#x7528;&#x7684;CommonJS&#x6A21;&#x5757;&#x3002;
&#x6211;&#x4EEC;&#x5728;&#x8FD9;&#x4E2A;&#x6559;&#x7A0B;&#x91CC;&#x4F1A;&#x4E00;&#x76F4;&#x4F7F;&#x7528;CommonJS&#x6A21;&#x5757;&#xFF0C;&#x4F46;&#x662F;&#x4F60;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4FEE;&#x6539;<code>module</code>&#x9009;&#x9879;&#x6765;&#x6539;&#x53D8;&#x8FD9;&#x4E2A;&#x884C;&#x4E3A;&#x3002;</p>
<h1 id="browserify">Browserify</h1>
<p>&#x73B0;&#x5728;&#xFF0C;&#x8BA9;&#x6211;&#x4EEC;&#x628A;&#x8FD9;&#x4E2A;&#x5DE5;&#x7A0B;&#x7531;Node.js&#x73AF;&#x5883;&#x79FB;&#x5230;&#x6D4F;&#x89C8;&#x5668;&#x73AF;&#x5883;&#x91CC;&#x3002;
&#x56E0;&#x6B64;&#xFF0C;&#x6211;&#x4EEC;&#x5C06;&#x628A;&#x6240;&#x6709;&#x6A21;&#x5757;&#x6346;&#x7ED1;&#x6210;&#x4E00;&#x4E2A;JavaScript&#x6587;&#x4EF6;&#x3002;
&#x6240;&#x5E78;&#xFF0C;&#x8FD9;&#x6B63;&#x662F;Browserify&#x8981;&#x505A;&#x7684;&#x4E8B;&#x60C5;&#x3002;
&#x66F4;&#x65B9;&#x4FBF;&#x7684;&#x662F;&#xFF0C;&#x5B83;&#x652F;&#x6301;Node.js&#x7684;CommonJS&#x6A21;&#x5757;&#xFF0C;&#x8FD9;&#x4E5F;&#x6B63;&#x662F;TypeScript&#x9ED8;&#x8BA4;&#x751F;&#x6210;&#x7684;&#x7C7B;&#x578B;&#x3002;
&#x4E5F;&#x5C31;&#x662F;&#x8BF4;TypeScript&#x548C;Node.js&#x7684;&#x8BBE;&#x7F6E;&#x4E0D;&#x9700;&#x8981;&#x6539;&#x53D8;&#x5C31;&#x53EF;&#x4EE5;&#x79FB;&#x690D;&#x5230;&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x3002;</p>
<p>&#x9996;&#x5148;&#xFF0C;&#x5B89;&#x88C5;Browserify&#xFF0C;<a href="https://www.npmjs.com/package/tsify" target="_blank">tsify</a>&#x548C;vinyl-source-stream&#x3002;
tsify&#x662F;Browserify&#x7684;&#x4E00;&#x4E2A;&#x63D2;&#x4EF6;&#xFF0C;&#x5C31;&#x50CF;gulp-typescript&#x4E00;&#x6837;&#xFF0C;&#x5B83;&#x80FD;&#x591F;&#x8BBF;&#x95EE;TypeScript&#x7F16;&#x8BD1;&#x5668;&#x3002;
vinyl-source-stream&#x4F1A;&#x5C06;Browserify&#x7684;&#x8F93;&#x51FA;&#x6587;&#x4EF6;&#x9002;&#x914D;&#x6210;gulp&#x80FD;&#x591F;&#x89E3;&#x6790;&#x7684;&#x683C;&#x5F0F;&#xFF0C;&#x5B83;&#x53EB;&#x505A;<a href="https://github.com/gulpjs/vinyl" target="_blank">vinyl</a>&#x3002;</p>
<pre><code class="lang-shell">npm install --save-dev browserify tsify vinyl-source-stream
</code></pre>
<h2 id="&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x9875;&#x9762;">&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x9875;&#x9762;</h2>
<p>&#x5728;<code>src</code>&#x76EE;&#x5F55;&#x4E0B;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;<code>index.html</code>&#x6587;&#x4EF6;&#xFF1A;</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE html&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">&quot;UTF-8&quot;</span> /&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Hello World!<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">id</span>=<span class="hljs-string">&quot;greeting&quot;</span>&gt;</span>Loading ...<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">&quot;bundle.js&quot;</span>&gt;</span><span class="undefined"></span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>&#x4FEE;&#x6539;<code>main.ts</code>&#x6587;&#x4EF6;&#x6765;&#x66F4;&#x65B0;&#x8FD9;&#x4E2A;&#x9875;&#x9762;&#xFF1A;</p>
<pre><code class="lang-ts"><span class="hljs-keyword">import</span> { sayHello } from <span class="hljs-string">&quot;./greet&quot;</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">showHello</span>(<span class="hljs-params">divName: <span class="hljs-built_in">string</span>, name: <span class="hljs-built_in">string</span></span>) </span>{
    <span class="hljs-keyword">const</span> elt = <span class="hljs-built_in">document</span>.getElementById(divName);
    elt.innerText = sayHello(name);
}

showHello(<span class="hljs-string">&quot;greeting&quot;</span>, <span class="hljs-string">&quot;TypeScript&quot;</span>);
</code></pre>
<p><code>showHello</code>&#x8C03;&#x7528;<code>sayHello</code>&#x51FD;&#x6570;&#x66F4;&#x6539;&#x9875;&#x9762;&#x4E0A;&#x6BB5;&#x843D;&#x7684;&#x6587;&#x5B57;&#x3002;
&#x73B0;&#x5728;&#x4FEE;&#x6539;gulpfile&#x6587;&#x4EF6;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> gulp = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp&quot;</span>);
<span class="hljs-keyword">var</span> browserify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;browserify&quot;</span>);
<span class="hljs-keyword">var</span> source = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;vinyl-source-stream&apos;</span>);
<span class="hljs-keyword">var</span> tsify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;tsify&quot;</span>);
<span class="hljs-keyword">var</span> paths = {
    pages: [<span class="hljs-string">&apos;src/*.html&apos;</span>]
};

gulp.task(<span class="hljs-string">&quot;copy-html&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> gulp.src(paths.pages)
        .pipe(gulp.dest(<span class="hljs-string">&quot;dist&quot;</span>));
});

gulp.task(<span class="hljs-string">&quot;default&quot;</span>, [<span class="hljs-string">&quot;copy-html&quot;</span>], <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> browserify({
        basedir: <span class="hljs-string">&apos;.&apos;</span>,
        debug: <span class="hljs-literal">true</span>,
        entries: [<span class="hljs-string">&apos;src/main.ts&apos;</span>],
        cache: {},
        packageCache: {}
    })
    .plugin(tsify)
    .bundle()
    .pipe(source(<span class="hljs-string">&apos;bundle.js&apos;</span>))
    .pipe(gulp.dest(<span class="hljs-string">&quot;dist&quot;</span>));
});
</code></pre>
<p>&#x8FD9;&#x91CC;&#x589E;&#x52A0;&#x4E86;<code>copy-html</code>&#x4EFB;&#x52A1;&#x5E76;&#x4E14;&#x628A;&#x5B83;&#x52A0;&#x4F5C;<code>default</code>&#x7684;&#x4F9D;&#x8D56;&#x9879;&#x3002;
&#x8FD9;&#x6837;&#xFF0C;&#x5F53;<code>default</code>&#x6267;&#x884C;&#x65F6;&#xFF0C;<code>copy-html</code>&#x4F1A;&#x88AB;&#x9996;&#x5148;&#x6267;&#x884C;&#x3002;
&#x6211;&#x4EEC;&#x8FD8;&#x4FEE;&#x6539;&#x4E86;<code>default</code>&#x4EFB;&#x52A1;&#xFF0C;&#x8BA9;&#x5B83;&#x4F7F;&#x7528;<code>tsify</code>&#x63D2;&#x4EF6;&#x8C03;&#x7528;Browserify&#xFF0C;&#x800C;&#x4E0D;&#x662F;<code>gulp-typescript</code>&#x3002;
&#x65B9;&#x4FBF;&#x7684;&#x662F;&#xFF0C;&#x4E24;&#x8005;&#x4F20;&#x9012;&#x76F8;&#x540C;&#x7684;&#x53C2;&#x6570;&#x5BF9;&#x8C61;&#x5230;TypeScript&#x7F16;&#x8BD1;&#x5668;&#x3002;</p>
<p>&#x8C03;&#x7528;<code>bundle</code>&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x4F7F;&#x7528;<code>source</code>&#xFF08;vinyl-source-stream&#x7684;&#x522B;&#x540D;&#xFF09;&#x628A;&#x8F93;&#x51FA;&#x6587;&#x4EF6;&#x547D;&#x540D;&#x4E3A;<code>bundle.js</code>&#x3002;</p>
<p>&#x6D4B;&#x8BD5;&#x6B64;&#x9875;&#x9762;&#xFF0C;&#x8FD0;&#x884C;<code>gulp</code>&#xFF0C;&#x7136;&#x540E;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x91CC;&#x6253;&#x5F00;<code>dist/index.html</code>&#x3002;
&#x4F60;&#x5E94;&#x8BE5;&#x80FD;&#x5728;&#x9875;&#x9762;&#x4E0A;&#x770B;&#x5230;&#x201C;Hello from TypeScript&#x201D;&#x3002;</p>
<p>&#x6CE8;&#x610F;&#xFF0C;&#x6211;&#x4EEC;&#x4E3A;Broswerify&#x6307;&#x5B9A;&#x4E86;<code>debug: true</code>&#x3002;
&#x8FD9;&#x4F1A;&#x8BA9;<code>tsify</code>&#x5728;&#x8F93;&#x51FA;&#x6587;&#x4EF6;&#x91CC;&#x751F;&#x6210;<code>source maps</code>&#x3002;
<code>source maps</code>&#x5141;&#x8BB8;&#x6211;&#x4EEC;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x4E2D;&#x76F4;&#x63A5;&#x8C03;&#x8BD5;TypeScript&#x6E90;&#x7801;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x5728;&#x5408;&#x5E76;&#x540E;&#x7684;JavaScript&#x6587;&#x4EF6;&#x4E0A;&#x8C03;&#x8BD5;&#x3002;
&#x4F60;&#x8981;&#x6253;&#x5F00;&#x8C03;&#x8BD5;&#x5668;&#x5E76;&#x5728;<code>main.ts</code>&#x91CC;&#x6253;&#x4E00;&#x4E2A;&#x65AD;&#x70B9;&#xFF0C;&#x770B;&#x770B;<code>source maps</code>&#x662F;&#x5426;&#x80FD;&#x5DE5;&#x4F5C;&#x3002;
&#x5F53;&#x4F60;&#x5237;&#x65B0;&#x9875;&#x9762;&#x65F6;&#xFF0C;&#x4EE3;&#x7801;&#x4F1A;&#x505C;&#x5728;&#x65AD;&#x70B9;&#x5904;&#xFF0C;&#x4ECE;&#x800C;&#x4F60;&#x5C31;&#x80FD;&#x591F;&#x8C03;&#x8BD5;<code>greet.ts</code>&#x3002;</p>
<h1 id="watchify&#xFF0C;babel&#x548C;uglify">Watchify&#xFF0C;Babel&#x548C;Uglify</h1>
<p>&#x73B0;&#x5728;&#x4EE3;&#x7801;&#x5DF2;&#x7ECF;&#x7528;Browserify&#x548C;tsify&#x6346;&#x7ED1;&#x5728;&#x4E00;&#x8D77;&#x4E86;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;Browserify&#x63D2;&#x4EF6;&#x4E3A;&#x6784;&#x5EFA;&#x6DFB;&#x52A0;&#x4E00;&#x4E9B;&#x7279;&#x6027;&#x3002;</p>
<ul>
<li><p>Watchify&#x542F;&#x52A8;Gulp&#x5E76;&#x4FDD;&#x6301;&#x8FD0;&#x884C;&#x72B6;&#x6001;&#xFF0C;&#x5F53;&#x4F60;&#x4FDD;&#x5B58;&#x6587;&#x4EF6;&#x65F6;&#x81EA;&#x52A8;&#x7F16;&#x8BD1;&#x3002;
&#x5E2E;&#x4F60;&#x8FDB;&#x5165;&#x5230;&#x7F16;&#x8F91;-&#x4FDD;&#x5B58;-&#x5237;&#x65B0;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5FAA;&#x73AF;&#x4E2D;&#x3002;</p>
</li>
<li><p>Babel&#x662F;&#x4E2A;&#x5341;&#x5206;&#x7075;&#x6D3B;&#x7684;&#x7F16;&#x8BD1;&#x5668;&#xFF0C;&#x5C06;ES2015&#x53CA;&#x4EE5;&#x4E0A;&#x7248;&#x672C;&#x7684;&#x4EE3;&#x7801;&#x8F6C;&#x6362;&#x6210;ES5&#x548C;ES3&#x3002;
&#x4F60;&#x53EF;&#x4EE5;&#x6DFB;&#x52A0;&#x5927;&#x91CF;&#x81EA;&#x5B9A;&#x4E49;&#x7684;TypeScript&#x76EE;&#x524D;&#x4E0D;&#x652F;&#x6301;&#x7684;&#x8F6C;&#x6362;&#x5668;&#x3002;</p>
</li>
<li><p>Uglify&#x5E2E;&#x4F60;&#x538B;&#x7F29;&#x4EE3;&#x7801;&#xFF0C;&#x5C06;&#x82B1;&#x8D39;&#x66F4;&#x5C11;&#x7684;&#x65F6;&#x95F4;&#x53BB;&#x4E0B;&#x8F7D;&#x5B83;&#x4EEC;&#x3002;</p>
</li>
</ul>
<h2 id="watchify">Watchify</h2>
<p>&#x6211;&#x4EEC;&#x542F;&#x52A8;Watchify&#xFF0C;&#x8BA9;&#x5B83;&#x5728;&#x540E;&#x53F0;&#x5E2E;&#x6211;&#x4EEC;&#x7F16;&#x8BD1;&#xFF1A;</p>
<pre><code class="lang-shell">npm install --save-dev watchify gulp-util
</code></pre>
<p>&#x4FEE;&#x6539;gulpfile&#x6587;&#x4EF6;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> gulp = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp&quot;</span>);
<span class="hljs-keyword">var</span> browserify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;browserify&quot;</span>);
<span class="hljs-keyword">var</span> source = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;vinyl-source-stream&apos;</span>);
<span class="hljs-keyword">var</span> watchify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;watchify&quot;</span>);
<span class="hljs-keyword">var</span> tsify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;tsify&quot;</span>);
<span class="hljs-keyword">var</span> gutil = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp-util&quot;</span>);
<span class="hljs-keyword">var</span> paths = {
    pages: [<span class="hljs-string">&apos;src/*.html&apos;</span>]
};

<span class="hljs-keyword">var</span> watchedBrowserify = watchify(browserify({
    basedir: <span class="hljs-string">&apos;.&apos;</span>,
    debug: <span class="hljs-literal">true</span>,
    entries: [<span class="hljs-string">&apos;src/main.ts&apos;</span>],
    cache: {},
    packageCache: {}
}).plugin(tsify));

gulp.task(<span class="hljs-string">&quot;copy-html&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> gulp.src(paths.pages)
        .pipe(gulp.dest(<span class="hljs-string">&quot;dist&quot;</span>));
});

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">bundle</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> watchedBrowserify
        .bundle()
        .pipe(source(<span class="hljs-string">&apos;bundle.js&apos;</span>))
        .pipe(gulp.dest(<span class="hljs-string">&quot;dist&quot;</span>));
}

gulp.task(<span class="hljs-string">&quot;default&quot;</span>, [<span class="hljs-string">&quot;copy-html&quot;</span>], bundle);
watchedBrowserify.on(<span class="hljs-string">&quot;update&quot;</span>, bundle);
watchedBrowserify.on(<span class="hljs-string">&quot;log&quot;</span>, gutil.log);
</code></pre>
<p>&#x5171;&#x6709;&#x4E09;&#x5904;&#x6539;&#x53D8;&#xFF0C;&#x4F46;&#x662F;&#x9700;&#x8981;&#x4F60;&#x7565;&#x5FAE;&#x91CD;&#x6784;&#x4E00;&#x4E0B;&#x4EE3;&#x7801;&#x3002;</p>
<ol>
<li>&#x5C06;<code>browserify</code>&#x5B9E;&#x4F8B;&#x5305;&#x88F9;&#x5728;<code>watchify</code>&#x7684;&#x8C03;&#x7528;&#x91CC;&#xFF0C;&#x63A7;&#x5236;&#x751F;&#x6210;&#x7684;&#x7ED3;&#x679C;&#x3002;</li>
<li>&#x8C03;&#x7528;<code>watchedBrowserify.on(&quot;update&quot;, bundle);</code>&#xFF0C;&#x6BCF;&#x6B21;TypeScript&#x6587;&#x4EF6;&#x6539;&#x53D8;&#x65F6;Browserify&#x4F1A;&#x6267;&#x884C;<code>bundle</code>&#x51FD;&#x6570;&#x3002;</li>
<li>&#x8C03;&#x7528;<code>watchedBrowserify.on(&quot;log&quot;, gutil.log);</code>&#x5C06;&#x65E5;&#x5FD7;&#x6253;&#x5370;&#x5230;&#x63A7;&#x5236;&#x53F0;&#x3002;</li>
</ol>
<p>(1)&#x548C;(2)&#x5728;&#x4E00;&#x8D77;&#x610F;&#x5473;&#x7740;&#x6211;&#x4EEC;&#x8981;&#x5C06;<code>browserify</code>&#x8C03;&#x7528;&#x79FB;&#x51FA;<code>default</code>&#x4EFB;&#x52A1;&#x3002;
&#x7136;&#x540E;&#x7ED9;&#x51FD;&#x6570;&#x8D77;&#x4E2A;&#x540D;&#x5B57;&#xFF0C;&#x56E0;&#x4E3A;Watchify&#x548C;Gulp&#x90FD;&#x8981;&#x8C03;&#x7528;&#x5B83;&#x3002;
(3)&#x662F;&#x53EF;&#x9009;&#x7684;&#xFF0C;&#x4F46;&#x662F;&#x5BF9;&#x4E8E;&#x8C03;&#x8BD5;&#x6765;&#x8BB2;&#x5F88;&#x6709;&#x7528;&#x3002;</p>
<p>&#x73B0;&#x5728;&#x5F53;&#x4F60;&#x6267;&#x884C;<code>gulp</code>&#xFF0C;&#x5B83;&#x4F1A;&#x542F;&#x52A8;&#x5E76;&#x4FDD;&#x6301;&#x8FD0;&#x884C;&#x72B6;&#x6001;&#x3002;
&#x8BD5;&#x7740;&#x6539;&#x53D8;<code>main.ts</code>&#x6587;&#x4EF6;&#x91CC;<code>showHello</code>&#x7684;&#x4EE3;&#x7801;&#x5E76;&#x4FDD;&#x5B58;&#x3002;
&#x4F60;&#x4F1A;&#x770B;&#x5230;&#x8FD9;&#x6837;&#x7684;&#x8F93;&#x51FA;&#xFF1A;</p>
<pre><code class="lang-shell">proj$ gulp
[10:34:20] Using gulpfile ~/src/proj/gulpfile.js
[10:34:20] Starting &apos;copy-html&apos;...
[10:34:20] Finished &apos;copy-html&apos; after 26 ms
[10:34:20] Starting &apos;default&apos;...
[10:34:21] 2824 bytes written (0.13 seconds)
[10:34:21] Finished &apos;default&apos; after 1.36 s
[10:35:22] 2261 bytes written (0.02 seconds)
[10:35:24] 2808 bytes written (0.05 seconds)
</code></pre>
<h2 id="uglify">Uglify</h2>
<p>&#x9996;&#x5148;&#x5B89;&#x88C5;Uglify&#x3002;
&#x56E0;&#x4E3A;Uglify&#x662F;&#x7528;&#x4E8E;&#x6DF7;&#x6DC6;&#x4F60;&#x7684;&#x4EE3;&#x7801;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x8FD8;&#x8981;&#x5B89;&#x88C5;vinyl-buffer&#x548C;gulp-sourcemaps&#x6765;&#x652F;&#x6301;sourcemaps&#x3002;</p>
<pre><code class="lang-shell">npm install --save-dev gulp-uglify vinyl-buffer gulp-sourcemaps
</code></pre>
<p>&#x4FEE;&#x6539;gulpfile&#x6587;&#x4EF6;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> gulp = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;gulp&quot;</span>);
<span class="hljs-keyword">var</span> browserify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;browserify&quot;</span>);
<span class="hljs-keyword">var</span> source = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;vinyl-source-stream&apos;</span>);
<span class="hljs-keyword">var</span> tsify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&quot;tsify&quot;</span>);
<span class="hljs-keyword">var</span> uglify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;gulp-uglify&apos;</span>);
<span class="hljs-keyword">var</span> sourcemaps = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;gulp-sourcemaps&apos;</span>);
<span class="hljs-keyword">var</span> buffer = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;vinyl-buffer&apos;</span>);
<span class="hljs-keyword">var</span> paths = {
    pages: [<span class="hljs-string">&apos;src/*.html&apos;</span>]
};

gulp.task(<span class="hljs-string">&quot;copy-html&quot;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> gulp.src(paths.pages)
        .pipe(gulp.dest(<span class="hljs-string">&quot;dist&quot;</span>));
});

gulp.task(<span class="hljs-string">&quot;default&quot;</span>, [<span class="hljs-string">&quot;copy-html&quot;</span>], <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> browserify({
        basedir: <span class="hljs-string">&apos;.&apos;</span>,
        debug: <span class="hljs-literal">true</span>,
        entries: [<span class="hljs-string">&apos;src/main.ts&apos;</span>],
        cache: {},
        packageCache: {}
    })
    .plugin(tsify)
    .bundle()
    .pipe(source(<span class="hljs-string">&apos;bundle.js&apos;</span>))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: <span class="hljs-literal">true</span>}))
    .pipe(uglify())
    .pipe(sourcemaps.write(<span class="hljs-string">&apos;./&apos;</span>))
    .pipe(gulp.dest(<span class="hljs-string">&quot;dist&quot;</span>));
});
</code></pre>
<p>&#x6CE8;&#x610F;<code>uglify</code>&#x53EA;&#x662F;&#x8C03;&#x7528;&#x4E86;&#x81EA;&#x5DF1;&#x2014;<code>buffer</code>&#x548C;<code>sourcemaps</code>&#x7684;&#x8C03;&#x7528;&#x662F;&#x7528;&#x4E8E;&#x786E;&#x4FDD;sourcemaps&#x53EF;&#x4EE5;&#x5DE5;&#x4F5C;&#x3002;
&#x8FD9;&#x4E9B;&#x8C03;&#x7528;&#x8BA9;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x5355;&#x72EC;&#x7684;sourcemap&#x6587;&#x4EF6;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x4E4B;&#x524D;&#x7684;&#x5185;&#x5D4C;&#x7684;sourcemaps&#x3002;
&#x4F60;&#x73B0;&#x5728;&#x53EF;&#x4EE5;&#x6267;&#x884C;<code>gulp</code>&#x6765;&#x68C0;&#x67E5;<code>bundle.js</code>&#x662F;&#x5426;&#x88AB;&#x538B;&#x7F29;&#x4E86;&#xFF1A;</p>
<pre><code class="lang-shell">gulp
cat dist/bundle.js
</code></pre>
<h2 id="babel">Babel</h2>
<p>&#x9996;&#x5148;&#x5B89;&#x88C5;Babelify&#x548C;ES2015&#x7684;Babel&#x9884;&#x7F6E;&#x7A0B;&#x5E8F;&#x3002;
&#x548C;Uglify&#x4E00;&#x6837;&#xFF0C;Babelify&#x4E5F;&#x4F1A;&#x6DF7;&#x6DC6;&#x4EE3;&#x7801;&#xFF0C;&#x56E0;&#x6B64;&#x6211;&#x4EEC;&#x4E5F;&#x9700;&#x8981;vinyl-buffer&#x548C;gulp-sourcemaps&#x3002;
&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;Babelify&#x53EA;&#x4F1A;&#x5904;&#x7406;&#x6269;&#x5C55;&#x540D;&#x4E3A;<code>.js</code>&#xFF0C;<code>.es</code>&#xFF0C;<code>.es6</code>&#x548C;<code>.jsx</code>&#x7684;&#x6587;&#x4EF6;&#xFF0C;&#x56E0;&#x6B64;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x6DFB;&#x52A0;<code>.ts</code>&#x6269;&#x5C55;&#x540D;&#x5230;Babelify&#x9009;&#x9879;&#x3002;</p>
<pre><code class="lang-shell">npm install --save-dev babelify babel-core babel-preset-es2015 vinyl-buffer gulp-sourcemaps
</code></pre>
<p>&#x4FEE;&#x6539;gulpfile&#x6587;&#x4EF6;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-js"><span class="hljs-keyword">var</span> gulp = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;gulp&apos;</span>);
<span class="hljs-keyword">var</span> browserify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;browserify&apos;</span>);
<span class="hljs-keyword">var</span> source = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;vinyl-source-stream&apos;</span>);
<span class="hljs-keyword">var</span> tsify = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;tsify&apos;</span>);
<span class="hljs-keyword">var</span> sourcemaps = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;gulp-sourcemaps&apos;</span>);
<span class="hljs-keyword">var</span> buffer = <span class="hljs-built_in">require</span>(<span class="hljs-string">&apos;vinyl-buffer&apos;</span>);
<span class="hljs-keyword">var</span> paths = {
    pages: [<span class="hljs-string">&apos;src/*.html&apos;</span>]
};

gulp.task(<span class="hljs-string">&apos;copyHtml&apos;</span>, <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> gulp.src(paths.pages)
        .pipe(gulp.dest(<span class="hljs-string">&apos;dist&apos;</span>));
});

gulp.task(<span class="hljs-string">&apos;default&apos;</span>, [<span class="hljs-string">&apos;copyHtml&apos;</span>], <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">return</span> browserify({
        basedir: <span class="hljs-string">&apos;.&apos;</span>,
        debug: <span class="hljs-literal">true</span>,
        entries: [<span class="hljs-string">&apos;src/main.ts&apos;</span>],
        cache: {},
        packageCache: {}
    })
    .plugin(tsify)
    .transform(<span class="hljs-string">&apos;babelify&apos;</span>, {
        presets: [<span class="hljs-string">&apos;es2015&apos;</span>],
        extensions: [<span class="hljs-string">&apos;.ts&apos;</span>]
    })
    .bundle()
    .pipe(source(<span class="hljs-string">&apos;bundle.js&apos;</span>))
    .pipe(buffer())
    .pipe(sourcemaps.init({loadMaps: <span class="hljs-literal">true</span>}))
    .pipe(sourcemaps.write(<span class="hljs-string">&apos;./&apos;</span>))
    .pipe(gulp.dest(<span class="hljs-string">&apos;dist&apos;</span>));
});
</code></pre>
<p>&#x6211;&#x4EEC;&#x9700;&#x8981;&#x8BBE;&#x7F6E;TypeScript&#x76EE;&#x6807;&#x4E3A;ES2015&#x3002;
Babel&#x7A0D;&#x540E;&#x4F1A;&#x4ECE;TypeScript&#x751F;&#x6210;&#x7684;ES2015&#x4EE3;&#x7801;&#x4E2D;&#x751F;&#x6210;ES5&#x3002;
&#x4FEE;&#x6539;<code>tsconfig.json</code>:</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;files&quot;</span>: [
        <span class="hljs-string">&quot;src/main.ts&quot;</span>
    ],
    <span class="hljs-string">&quot;compilerOptions&quot;</span>: {
        <span class="hljs-string">&quot;noImplicitAny&quot;</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-string">&quot;target&quot;</span>: <span class="hljs-string">&quot;es2015&quot;</span>
    }
}
</code></pre>
<p>&#x5BF9;&#x4E8E;&#x8FD9;&#x6837;&#x4E00;&#x6BB5;&#x7B80;&#x5355;&#x7684;&#x4EE3;&#x7801;&#x6765;&#x8BF4;&#xFF0C;Babel&#x7684;ES5&#x8F93;&#x51FA;&#x5E94;&#x8BE5;&#x548C;TypeScript&#x7684;&#x8F93;&#x51FA;&#x76F8;&#x4F3C;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="ASP.NET 4.html" class="navigation navigation-prev " aria-label="Previous page: ASP.NET 4">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Knockout.html" class="navigation navigation-next " aria-label="Next page: Knockout.js">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Gulp","level":"1.2.4","depth":2,"next":{"title":"Knockout.js","level":"1.2.5","depth":2,"path":"doc/handbook/tutorials/Knockout.md","ref":"./doc/handbook/tutorials/Knockout.md","articles":[]},"previous":{"title":"ASP.NET 4","level":"1.2.3","depth":2,"path":"doc/handbook/tutorials/ASP.NET 4.md","ref":"./doc/handbook/tutorials/ASP.NET 4.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"Patrick Zhong","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"preface.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"TypeScript Handbook","language":"zh-hans","gitbook":">3.0.0","description":"Translation of official TypeScript Handbook"},"file":{"path":"doc/handbook/tutorials/Gulp.md","mtime":"2018-10-13T09:48:54.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-13T09:57:42.904Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

